
//package GuiLayer;
//import ControlLayer.CtrOrder;
//import ModelLayer.Offer;
//
//import java.awt.EventQueue;
//
//import javax.swing.JFrame;
//import javax.swing.JPanel;
//import javax.swing.border.EmptyBorder;
//import javax.swing.GroupLayout;
//import javax.swing.GroupLayout.Alignment;
//import javax.swing.JLabel;
//import javax.swing.JTextField;
//import javax.swing.LayoutStyle.ComponentPlacement;
//import javax.swing.JButton;
//import javax.swing.JTextArea;
//import javax.swing.AbstractAction;
//import java.awt.event.ActionEvent;
//import java.util.ArrayList;
//import javax.swing.Action;
//
//public class GUIOfferList extends JFrame {
//
//    private JPanel contentPane;
//    private JTextField idInsert;
//    private JTextField textCreateDate;
//    private JTextField textPaymentDeadLine;
//    private JTextField textOrderStatus;
//    private JTextArea offerText;
//    private final Action action = new SwingAction();
//    private JLabel lblNewLabel;
//    private JLabel lblNewLabel_1;
//    private JLabel lblNewLabel_2;
//    private final Action action_1 = new SwingAction_1();
//    private JButton btnNewButton_1;
//    private final Action action_2 = new SwingAction_2();
//    private JButton btnNewButton_2;
//    private final Action action_3 = new SwingAction_3();
//
//    /**
//     * Launch the application.
//     */
//    public static void main(String[] args) {
//        EventQueue.invokeLater(new Runnable() {
//            public void run() {
//                try {
//                    GUIOfferList frame = new GUIOfferList();
//                    frame.setVisible(true);
//                } catch (Exception e) {
//                    e.printStackTrace();
//                }
//            }
//        });
//    }
//
//    /**
//     * Create the frame.
//     */
//    public GUIOfferList() {
//        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//        setBounds(100, 100, 591, 427);
//        contentPane = new JPanel();
//        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
//        setContentPane(contentPane);
//
//        JLabel lblId = new JLabel("id");
//
//        idInsert = new JTextField();
//        idInsert.setColumns(10);
//
//        JButton btnNewButton = new JButton("Opret Order");
//        btnNewButton.setAction(action_1);
//
//        textCreateDate = new JTextField();
//        textCreateDate.setColumns(10);
//
//        textPaymentDeadLine = new JTextField();
//        textPaymentDeadLine.setColumns(10);
//
//        textOrderStatus = new JTextField();
//        textOrderStatus.setColumns(10);
//
//        offerText = new JTextArea();
//
//        JButton btnGo = new JButton("Go");
//        btnGo.setAction(action);
//
//        lblNewLabel = new JLabel("Create Date");
//
//        lblNewLabel_1 = new JLabel("Payment Deadline");
//
//        lblNewLabel_2 = new JLabel("Order Status");
//
//        btnNewButton_1 = new JButton("New button");
//        btnNewButton_1.setAction(action_2);
//
//        btnNewButton_2 = new JButton("New button");
//        btnNewButton_2.setAction(action_3);
//        GroupLayout gl_contentPane = new GroupLayout(contentPane);
//        gl_contentPane.setHorizontalGroup(
//                gl_contentPane.createParallelGroup(Alignment.LEADING)
//                        .addGroup(gl_contentPane.createSequentialGroup()
//                                .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
//                                        .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
//                                                .addGroup(gl_contentPane.createSequentialGroup()
//                                                        .addComponent(lblId)
//                                                        .addPreferredGap(ComponentPlacement.RELATED)
//                                                        .addComponent(idInsert, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
//                                                        .addPreferredGap(ComponentPlacement.RELATED)
//                                                        .addComponent(btnGo)
//                                                        .addPreferredGap(ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
//                                                        .addComponent(btnNewButton_2)
//                                                        .addPreferredGap(ComponentPlacement.RELATED)
//                                                        .addComponent(btnNewButton_1)
//                                                        .addPreferredGap(ComponentPlacement.RELATED)
//                                                        .addComponent(btnNewButton))
//                                                .addGroup(gl_contentPane.createSequentialGroup()
//                                                        .addGap(321)
//                                                        .addGroup(gl_contentPane.createParallelGroup(Alignment.TRAILING)
//                                                                .addComponent(lblNewLabel)
//                                                                .addComponent(lblNewLabel_1)
//                                                                .addComponent(lblNewLabel_2))
//                                                        .addPreferredGap(ComponentPlacement.UNRELATED)
//                                                        .addGroup(gl_contentPane.createParallelGroup(Alignment.LEADING, false)
//                                                                .addComponent(textCreateDate, Alignment.TRAILING)
//                                                                .addComponent(textPaymentDeadLine, Alignment.TRAILING)
//                                                                .addComponent(textOrderStatus, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 119, Short.MAX_VALUE))))
//                                        .addComponent(offerText, GroupLayout.PREFERRED_SIZE, 297, GroupLayout.PREFERRED_SIZE))
//                                .addGap(49))
//        );
//        gl_contentPane.setVerticalGroup(
//                gl_contentPane.createParallelGroup(Alignment.LEADING)
//                        .addGroup(gl_contentPane.createSequentialGroup()
//                                .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
//                                        .addComponent(lblId)
//                                        .addComponent(idInsert, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
//                                        .addComponent(btnGo)
//                                        .addComponent(btnNewButton)
//                                        .addComponent(btnNewButton_1)
//                                        .addComponent(btnNewButton_2))
//                                .addPreferredGap(ComponentPlacement.RELATED)
//                                .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
//                                        .addComponent(textCreateDate, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
//                                        .addComponent(lblNewLabel))
//                                .addPreferredGap(ComponentPlacement.RELATED)
//                                .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
//                                        .addComponent(textPaymentDeadLine, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
//                                        .addComponent(lblNewLabel_1))
//                                .addPreferredGap(ComponentPlacement.RELATED)
//                                .addGroup(gl_contentPane.createParallelGroup(Alignment.BASELINE)
//                                        .addComponent(textOrderStatus, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
//                                        .addComponent(lblNewLabel_2))
//                                .addPreferredGap(ComponentPlacement.RELATED, 24, Short.MAX_VALUE)
//                                .addComponent(offerText, GroupLayout.PREFERRED_SIZE, 254, GroupLayout.PREFERRED_SIZE))
//        );
//        contentPane.setLayout(gl_contentPane);
//    }
//
//    private class SwingAction extends AbstractAction
//    {
//        public SwingAction()
//        {
//            putValue(NAME, "Find Offers");
//            putValue(SHORT_DESCRIPTION, "Some short description");
//        }
//        public void actionPerformed(ActionEvent e)
//        {
//            try
//            {
//                getAllOffers();
//            }
//            catch(Exception ex)
//            {
//                System.out.println("Offer could not be found");
//            }
//        }
//    }
//
//    private class SwingAction_1 extends AbstractAction
//    {
//        public SwingAction_1()
//        {
//            putValue(NAME, "Create Order");
//            putValue(SHORT_DESCRIPTION, "Some short description");
//        }
//        public void actionPerformed(ActionEvent e)
//        {
//            try
//            {
//                getAllOffers();
//            }
//            catch(Exception ex)
//            {
//                System.out.println("Offers could not be found");
//            }
//        }
//    }
//
//    private class SwingAction_2 extends AbstractAction
//    {
//        public SwingAction_2()
//        {
//            putValue(NAME, "Update Offer");
//            putValue(SHORT_DESCRIPTION, "Some short description");
//        }
//        public void actionPerformed(ActionEvent e)
//        {
//
//        }
//    }
//
//
//    private class SwingAction_3 extends AbstractAction
//    {
//        public SwingAction_3()
//        {
//            putValue(NAME, "Delete Offer");
//            putValue(SHORT_DESCRIPTION, "Some short description");
//        }
//        public void actionPerformed(ActionEvent e)
//        {
//
//        }
//    }
//
//
//    public void getAllOffers() throws Exception
//    {
//        offerText.setText("");
//        String id = idInsert.getText();
//        System.out.println(id);
//
//        CtrOffer ctrlOff = new CtrOffer();
//
//        String idOffer;
//
//        ArrayList<Offer> offList = ctrlOff.GetAllOffers();
//        for (int i = 0; offList.size() < i; i++)
//        {
//            idOffer = offList.get(i).getIdOffer();
//        }
//
//
//        if (idOffer != null){
//        offerText.insert(idOffer, 0);
//        }
//
//    }
//
//
//    public void createOrder() throws Exception
//    {
//        CtrOrder ctrOrd = new CtrOrder();
//
//        String id = idInsert.getText();
//        String createdDate = textCreateDate.getText();
//        String paymentDeadline = textPaymentDeadLine.getText();
//        String statusOrder = textOrderStatus.getText();
//
//        ctrOrd.insertOrder(id, createdDate, paymentDeadline, statusOrder);
//    }
//
//}
